//
//  Nest_Type_InClass.hpp
//  learnC++
//
//  Created by apple on 2018/6/4.
//  Copyright © 2018年 yunfan.com. All rights reserved.
//

#ifndef Nest_Type_InClass_hpp
#define Nest_Type_InClass_hpp

#include <stdio.h>
#include <iostream>

class Fruit {
public:
    //嵌套类型
    enum FruitType{
        APPLE,
        BANANA,
        CHEERY
    };
    
    typedef FruitType CustomType;
    
private:
    FruitType m_type;
    int m_percentageEaten = 0;
    
public:
    
    Fruit(FruitType type);
    
    FruitType getType();
    
    int getPercentageEaten();
};

/*
 //调用
 如果我们将FruitType中的FruitType嵌套为枚举类而不是枚举类型，我们将通过Fruit :: FruitType :: APPLE访问APPLE枚举器
 // Note: we access the FruitType via Fruit now
 Fruit apple(Fruit::APPLE);
 
 if (apple.getType() == Fruit::APPLE)
 std::cout << "I am an apple";
 else
 std::cout << "I am not an apple";
 */


#endif /* Nest_Type_InClass_hpp */
